﻿using Kingdee.BOS.Orm.DataEntity;
using SD.WRZS.K3.ServiceFacade.KDServiceEntity.Mobile;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SDWXServer.Models
{
    /// <summary>
    /// 员工
    /// </summary>
    [Serializable]
    public class WXEmpinfo : AbstractBillObject
    {
        public WXEmpinfo()
        {
            Organization = new Organization();
        }
        /// <summary>
        /// Id
        /// </summary>
        public string Id { get; set; }
        /// <summary>
        /// AppId
        /// </summary>
        public string AppId { get; set; }
        /// <summary>
        /// 内码
        /// </summary>
        public Int64 BillId { get; set; }
        /// <summary>
        /// 单据编码
        /// </summary>
        public string BillNO { get; set; }
        /// <summary>
        /// 单据状态
        /// </summary>
        public string DocumentStatus { get; set; }
        /// <summary>
        /// 单据状态名称
        /// </summary>
        public string DocumentStatusName { get; set; }
        /// <summary>
        /// 组织
        /// </summary>
        public Organization Organization { get; set; }
        /// <summary>
        /// 员工名称
        /// </summary>
        public string EmpinfoName { get; set; }
        /// <summary>
        /// 账户余额
        /// </summary>
        public string Empinfoye { get; set; }
        /// <summary>
        /// 手机号
        /// </summary>
        public string EmpinPhone { get; set; }
        public static WXEmpinfo Parse(DynamicObject obj)
        {
            var item = new WXEmpinfo();
            item.Id = string.Format("SZGD_Empinfo_{0}", Convert.ToInt64(obj["Id"]));
            item.AppId = string.Format("SZGD_Empinfo_{0}", Convert.ToInt64(obj["Id"]));
            item.BillId = Convert.ToInt64(obj["Id"]);
            item.BillNO = Convert.ToString(obj["FStaffNumber"]);
            //item.BillDate = Convert.ToDateTime(obj["Date"]);
            item.DocumentStatus = Convert.ToString(obj["DocumentStatus"]);
            switch (item.DocumentStatus)
            {
                case "Z":
                    item.DocumentStatusName = "暂存";
                    break;
                case "A":
                    item.DocumentStatusName = "创建";
                    break;
                case "B":
                    item.DocumentStatusName = "审核中";
                    break;
                case "C":
                    item.DocumentStatusName = "已审核";
                    break;
                case "D":
                    item.DocumentStatusName = "重新审核";
                    break;
            }
            var orgObj = obj["UseOrgId"] as DynamicObject;
            item.Organization.Id = Convert.ToInt64(orgObj["Id"]);
            item.Organization.Number = Convert.ToString(orgObj["Number"]);
            item.Organization.Name = Convert.ToString(orgObj["Name"]);
            item.EmpinfoName = Convert.ToString(obj["Name"]);
            item.EmpinPhone = Convert.ToString(obj["Mobile"]);

            return item;
        }
    }
    /// <summary>
    /// 组织
    /// </summary>
    public class WXMSXZOrg : AbstractBillObject
    {
        public WXMSXZOrg()
        {

        }
        /// <summary>
        /// Id
        /// </summary>
        public string Id { get; set; }
        /// <summary>
        /// AppId
        /// </summary>
        public string AppId { get; set; }
        /// <summary>
        /// 内码
        /// </summary>
        public Int64 OrgId { get; set; }
        /// <summary>
        /// 单据编码
        /// </summary>
        public string OrgNumber { get; set; }
        /// <summary>
        /// 组织名称
        /// </summary>
        public string OrgName { get; set; }
        public static WXMSXZOrg Parse(DynamicObject obj)
        {
            var item = new WXMSXZOrg();
            item.Id = string.Format("MSXZ_Org_{0}", Convert.ToInt64(obj["Id"]));
            item.AppId = string.Format("MSXZ_Org_{0}", Convert.ToInt64(obj["Id"]));
            item.OrgId = Convert.ToInt64(obj["Id"]);
            item.OrgNumber = Convert.ToString(obj["Number"]);
            item.OrgName = Convert.ToString(obj["Name"]);
            return item;
        }
    }



    /// <summary>
    /// 餐品
    /// </summary>
    [Serializable]
    public class WXCanPin : AbstractBillObject
    {
        public WXCanPin()
        {
            Organization = new Organization();
        }
        /// <summary>
        /// Id
        /// </summary>
        public string Id { get; set; }
        /// <summary>
        /// AppId
        /// </summary>
        public string AppId { get; set; }
        /// <summary>
        /// 内码
        /// </summary>
        public Int64 BillId { get; set; }
        /// <summary>
        /// 单据编码
        /// </summary>
        public string BillNO { get; set; }
        /// <summary>
        /// 单据状态
        /// </summary>
        public string DocumentStatus { get; set; }
        /// <summary>
        /// 单据状态名称
        /// </summary>
        public string DocumentStatusName { get; set; }
        /// <summary>
        /// 组织
        /// </summary>
        public Organization Organization { get; set; }
        /// <summary>
        /// 餐品名称
        /// </summary>
        public string CanPinName { get; set; }
        /// <summary>
        /// 餐品金额
        /// </summary>
        public string CanPinMoney { get; set; }
        public static WXCanPin Parse(DynamicObject obj)
        {
            var item = new WXCanPin();
            item.Id = string.Format("MSCF_CanPin_{0}", Convert.ToInt64(obj["Id"]));
            item.AppId = string.Format("MSCF_CanPin_{0}", Convert.ToInt64(obj["Id"]));
            item.BillId = Convert.ToInt64(obj["Id"]);
            item.BillNO = Convert.ToString(obj["Number"]);
            //item.BillDate = Convert.ToDateTime(obj["Date"]);
            item.DocumentStatus = Convert.ToString(obj["DocumentStatus"]);
            switch (item.DocumentStatus)
            {
                case "Z":
                    item.DocumentStatusName = "暂存";
                    break;
                case "A":
                    item.DocumentStatusName = "创建";
                    break;
                case "B":
                    item.DocumentStatusName = "审核中";
                    break;
                case "C":
                    item.DocumentStatusName = "已审核";
                    break;
                case "D":
                    item.DocumentStatusName = "重新审核";
                    break;
            }
            var orgObj = obj["UseOrgId"] as DynamicObject;
            item.Organization.Id = Convert.ToInt64(orgObj["Id"]);
            item.Organization.Number = Convert.ToString(orgObj["Number"]);
            item.Organization.Name = Convert.ToString(orgObj["Name"]);
            item.CanPinName = Convert.ToString(obj["Name"]);
            item.CanPinMoney = Convert.ToString(obj["F_BSD_CPJE"]);

            return item;
        }
    }





    /// <summary>
    /// 证件类型
    /// </summary>
    [Serializable]
    public class WXZhengJianLeiXing : AbstractBillObject
    {
        /// <summary>
        /// 证件类型编码
        /// </summary>
        public string ZhengJianLeiXingValue { get; set; }
        /// <summary>
        /// 证件类型名称
        /// </summary>
        public string ZhengJianLeiXingName { get; set; }

        public static WXZhengJianLeiXing Parse(DynamicObject obj)
        {
            var item = new WXZhengJianLeiXing();
            //item.Id = string.Format("MSCF_ZhengJianLeiXing_{0}", Convert.ToInt64(obj["Id"]));
            //item.AppId = string.Format("MSCF_ZhengJianLeiXing_{0}", Convert.ToInt64(obj["Id"]));
            item.ZhengJianLeiXingValue = Convert.ToString(obj["FVALUE"]);
            item.ZhengJianLeiXingName = Convert.ToString(obj["FCAPTION"]);
            //item.BillDate = Convert.ToDateTime(obj["Date"]);
            return item;
        }
    }

    /// <summary>
    /// 人员类型
    /// </summary>
    [Serializable]
    public class WXRenYuanLeiXing : AbstractBillObject
    {
        /// <summary>
        /// 人员类型编码
        /// </summary>
        public string RenYuanLeiXingValue { get; set; }
        /// <summary>
        /// 人员类型名称
        /// </summary>
        public string RenYuanLeiXingName { get; set; }

        public static WXRenYuanLeiXing Parse(DynamicObject obj)
        {
            var item = new WXRenYuanLeiXing();
            //item.Id = string.Format("MSCF_ZhengJianLeiXing_{0}", Convert.ToInt64(obj["Id"]));
            //item.AppId = string.Format("MSCF_ZhengJianLeiXing_{0}", Convert.ToInt64(obj["Id"]));
            item.RenYuanLeiXingValue = Convert.ToString(obj["FVALUE"]);
            item.RenYuanLeiXingName = Convert.ToString(obj["FCAPTION"]);
            //item.BillDate = Convert.ToDateTime(obj["Date"]);
            return item;
        }
    }



    /// <summary>
    /// 业务分类
    /// </summary>
    [Serializable]
    public class WXRYeWuFenLei : AbstractBillObject
    {
        /// <summary>
        /// 人员类型编码
        /// </summary>
        public string YeWuFenLeiValue { get; set; }
        /// <summary>
        /// 人员类型名称
        /// </summary>
        public string YeWuFenLeiName { get; set; }

        public static WXRYeWuFenLei Parse(DynamicObject obj)
        {
            var item = new WXRYeWuFenLei();
            //item.Id = string.Format("MSCF_ZhengJianLeiXing_{0}", Convert.ToInt64(obj["Id"]));
            //item.AppId = string.Format("MSCF_ZhengJianLeiXing_{0}", Convert.ToInt64(obj["Id"]));
            item.YeWuFenLeiValue = Convert.ToString(obj["FVALUE"]);
            item.YeWuFenLeiName = Convert.ToString(obj["FCAPTION"]);
            //item.BillDate = Convert.ToDateTime(obj["Date"]);
            return item;
        }
    }


    /// <summary>
    /// 餐品
    /// </summary>
    [Serializable]
    public class WXCLRY : AbstractBillObject
    {
        public WXCLRY()
        {
            Organization = new Organization();
        }
        /// <summary>
        /// Id
        /// </summary>
        public string Id { get; set; }
        /// <summary>
        /// AppId
        /// </summary>
        public string AppId { get; set; }
        /// <summary>
        /// 内码
        /// </summary>
        public Int64 BillId { get; set; }
        /// <summary>
        /// 单据编码
        /// </summary>
        public string BillNO { get; set; }
        /// <summary>
        /// 单据状态
        /// </summary>
        public string DocumentStatus { get; set; }
        /// <summary>
        /// 单据状态名称
        /// </summary>
        public string DocumentStatusName { get; set; }
        /// <summary>
        /// 组织
        /// </summary>
        public Organization Organization { get; set; }
        /// <summary>
        /// 车辆人员
        /// </summary>
        public string CLRYName { get; set; }
        /// <summary>
        /// 车牌号
        /// </summary>
        public string CarNum { get; set; }
        public static WXCLRY Parse(DynamicObject obj)
        {
            var item = new WXCLRY();
            item.Id = string.Format("MSCF_CheLiangRenYuan_{0}", Convert.ToInt64(obj["Id"]));
            item.AppId = string.Format("MSCF_CheLiangRenYuan_{0}", Convert.ToInt64(obj["Id"]));
            item.BillId = Convert.ToInt64(obj["Id"]);
            item.BillNO = Convert.ToString(obj["Number"]);
            item.CLRYName = Convert.ToString(obj["Name"]);
            item.CarNum = Convert.ToString(obj["FCARNUM"]);
            //item.BillDate = Convert.ToDateTime(obj["Date"]);
            item.DocumentStatus = Convert.ToString(obj["DocumentStatus"]);
            switch (item.DocumentStatus)
            {
                case "Z":
                    item.DocumentStatusName = "暂存";
                    break;
                case "A":
                    item.DocumentStatusName = "创建";
                    break;
                case "B":
                    item.DocumentStatusName = "审核中";
                    break;
                case "C":
                    item.DocumentStatusName = "已审核";
                    break;
                case "D":
                    item.DocumentStatusName = "重新审核";
                    break;
            }
            var orgObj = obj["UseOrgId"] as DynamicObject;
            item.Organization.Id = Convert.ToInt64(orgObj["Id"]);
            item.Organization.Number = Convert.ToString(orgObj["Number"]);
            item.Organization.Name = Convert.ToString(orgObj["Name"]);

            return item;
        }
    }


}